import axios from '../axios';

/** *********获取收益凭证产品列表******** */
export const getFinanList = (pageNum, pageSize) => axios.post('dz-mall/r/product/getFinanList', {
  pageNum, // 非必填
  pageSize // 非必填
});

/** *********根据prodCode查询产品详情******** */
export const getFinanByCode = (prodCode) => axios.post('dz-mall/r/product/getFinanProd', {
  prodCode
}, {
  loading: true
});

/** *********获取私募产品列表******** */
export const getPEFundList = () => axios.post('dz-mall/r/product/getPEList', {}, {
  loading: true
});

/** *********获取信托产品列表******** */
export const getTrustFundList = () => axios.post('dz-mall/r/product/getTFList');

/** *********获取私募产品列表******** */
export const getPEProdByCode = (prodCode) => axios.post('dz-mall/r/product/getPEProdByCode', {
  prodCode
});

/** *********获取信托产品******** */
export const getTFProdByCode = (prodCode) => axios.post('dz-mall/r/product/getTFProdByCode', {
  prodCode
});

/** *********获取私募或信托产品******** */
export const getProdByCode = (prodCode) => axios.post('dz-mall/r/product/getProdByCode', {
  prodCode
}, {
  loading: true
});

/** *********获取私募基金净值数据******** */
export const getNavFromT2 = (params) => axios.post('dz-mall/r/product/getNavFromT2', {
  productCode: params.productCode,
  ta: params.ta,
  range: params.range, // 按天数查询
  requestNum: params.requestNum, // 分页查询，一页条数
  positionStr: params.positionStr
});

/** *********收益凭证产品的下订单******** */
export const doFinanOrder = (params) => axios.post('dz-mall/r/order/finan/buy', {
  productCode: params.productCode,
  totPrice: params.totalPrice,
  orderChannel: params.orderChannel, // 业务类型，非必须
  recommendId: params.recommendId, // 拓展人id，非必须
  managerId: params.managerId// 理财经理id,非必须
}, {
  loading: true
});

/** *********撤销收益凭证产品订单******** */
export const doFinanRevoke = (allotNo) => axios.post('dz-mall/r/order/finan/revoke', {
  allotNo
}, {
  loading: true
});

/** *********收益凭证产品赎回份额******** */
export const finanRedeem = (params) => axios.post('dz-mall/r/order/finan/redeem', {
  productCode: params.productCode,
  amount: params.amount,
  orderChannel: params.orderChannel, // 非必须
  managerId: params.managerId // 非必须
}, {
  loading: true
});
